package com.yaozheng.vocationaltraining.activity;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;

import android.view.View;
import android.widget.TextView;

import com.yaozheng.vocationaltraining.R;
import com.yaozheng.vocationaltraining.fragment.LastAcademicRecordsFragment;
import com.yaozheng.vocationaltraining.fragment.LastAcademicRecordsFragment_;
import com.yaozheng.vocationaltraining.fragment.MemoryWealthFragment;
import com.yaozheng.vocationaltraining.fragment.MemoryWealthFragment_;

/**
 * 学习记录
 * 
 * @author Administrator
 * 
 */
@EActivity(R.layout.activity_learn_recording)
public class LearnRecordingActivity extends BaseActivity {
	/**
	 * 记忆财富(你该复习的课程)碎片
	 */
	MemoryWealthFragment memoryWealthFragment;
	/**
	 * 上次学习进度碎片
	 */
	LastAcademicRecordsFragment lastAcademicRecordsFragment;

	View lastView;
	@ViewById
	TextView footerMemoryWealthText;

	@AfterViews
	public void initView() {
		footerMemoryWealthClick();
		footerClick(footerMemoryWealthText);
	}

	/**
	 * 底部记忆财富(你该复习的课程)点击
	 */
	public void footerMemoryWealthClick() {
		if (memoryWealthFragment == null) {
			memoryWealthFragment = MemoryWealthFragment_.builder().build();
		}
		showCurrFragment(memoryWealthFragment);
	}

	/**
	 * 底部上次学习进度点击
	 */
	public void footerLastAcademicRecordsClick() {
		if (lastAcademicRecordsFragment == null) {
			lastAcademicRecordsFragment = LastAcademicRecordsFragment_
					.builder().build();
		}
		showCurrFragment(lastAcademicRecordsFragment);
	}

	/**
	 * 底部点击
	 * 
	 * @param view
	 */
	public void footerClick(View view) {
		if (lastView != null && view != lastView) {
			lastView.setSelected(false);

		}

		view.setSelected(true);
		lastView = view;
		reflexRunClick(view);
	}
}
